
import { BeatMapParserV2 } from "./BeatMapParserV2"
import {BeatMapParserV3} from "./BeatMapParserV3"
import { BeatMapParserV4 } from "./BeatMapParserV4"

function constructBeatMapParser(info, diffMapData){
  const version = diffMapData["version"] || diffMapData["_version"]
  switch (version) {
    case '4.0.0':
    case '4.1.0':
      return new BeatMapParserV4(info, diffMapData)
    case '3.0.0':
    case '3.2.0':
    case '3.3.0':
      return new BeatMapParserV3(info, diffMapData)
    case '2.6.0':
    case '2.2.0':
    case '2.0.0':
      return new BeatMapParserV2(info, diffMapData)
    default:
      console.error("Unknown beatmap version: " + version);
  }
  return null;
}

export {constructBeatMapParser}